<?php
	// If Process type is PREVIEW/EDIT/DELETE, Get All variables needed to be displayed by form, Edit SQL & Variable if necessary !!!
	if($process_type == "PREVIEW" || $process_type == "EDIT" || $process_type == "DELETE")
	{
		$sql2 = "select * from ms_user where stsrc = 'A' and userid = '".$PK_id."' ";
		$exe2 = mysql_query($sql2) or die(mysql_error());
		$num2 = mysql_num_rows($exe2);
		$row2 = mysql_fetch_array($exe2);
		
		// Set Value if data is found
		if($num2>0)
		{
			$val_user_PK_id = $row2['userid'];
			$val_user_name = $row2['username'];
			$val_user_group_id = $row2['usergroupid'];
			$val_user_activate = $row2['userstatus'];
		}
		else
		{
			$val_user_PK_id = "";
			$val_user_name = "";
			$val_user_group_id = "";
			$val_user_activate = "";
		}
	}
	else
	{
		$val_user_PK_id = "";
		$val_user_name = "";
		$val_user_group_id = "";
		$val_user_activate = "";
	}
	
?>
<!-- Start Row Data -->
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Group</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" name="txt_user_group" value="<?php echo $val_user_group_id; ?>" style="width:200px; height:18px;" />
			<?php
				$sql3 = "select usergroupid, usergroupname from ms_user_group where stsrc = 'A' and usergroupid > ".$_SESSION['usergroupid']." ";
				$exe3 = mysql_query($sql3) or die(mysql_error());
				$num3 = mysql_num_rows($exe3);
				
				if($num3 > 0)
				{
			?>
			<select <?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) && ($process_type == "PREVIEW" || $process_type == "DELETE")){echo "disabled='disabled'";} ?> name="txt_user_group">
				<?php if($process_type == "ADD"){ ?><option value="-1" >Select Group !</option><?php } ?>
				<?php
					
					
					while($row3 = mysql_fetch_array($exe3))
					{
				?>
				<option <?php if($row3['usergroupid'] == $val_user_group_id && ($process_type == "EDIT" || $process_type == "PREVIEW") || $process_type == "DELETE"){echo "selected=selected";} ?> value="<?php echo $row3['usergroupid']; ?>" ><?php echo ucwords(strtolower($row3['usergroupname'])); ?></option>
				<?php
					}
				?>
			</select>
			<?php
				}
				else
				{
			?>
				<span style="color:#FF0000;">No Data !</span>
			<?php
				}
			?>
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Name</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" type="text" name="txt_user_name" value="<?php echo $val_user_name; ?>" />
		<input <?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) && ($process_type == "PREVIEW" || $process_type == "DELETE")){echo "disabled='disabled'";} ?> type="text" required name="txt_user_name" value="<?php echo $val_user_name; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Activate</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" name="txt_user_PK_id" value="<?php echo $PK_id; ?>" style="width:200px; height:18px;" />
		<input type="hidden" name="rdo_user_activate" value="<?php echo $val_user_activate; ?>" style="width:200px; height:18px;" />
		<input <?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) && ($process_type == "PREVIEW" || $process_type == "DELETE")){echo "disabled='disabled'";} ?> type="radio" name="rdo_user_activate" value="1" <?php if(isset($val_user_activate)){if($val_user_activate == 1){echo "checked='true'";}} ?> /> Yes
		<input <?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) && ($process_type == "PREVIEW" || $process_type == "DELETE")){echo "disabled='disabled'";} ?> type="radio" name="rdo_user_activate" value="0" <?php if(isset($val_user_activate)){if($val_user_activate == 0){echo "checked='true'";}} ?> /> No
	</div>
	<div style="clear:both;"></div>
</div>
<?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) && ($process_type == "ADD" || $process_type == "EDIT")){ ?>
<div class="divFormRowData">
<hr />
</div>
<?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) && ($process_type == "EDIT")){ ?>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Change Password</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="radio" name="rdo_user_chgpass" id="rdoPasswordYes" onclick="showhidePassword();" value="1" /> Yes
		<input type="radio" name="rdo_user_chgpass" id="rdoPasswordNo" onclick="showhidePassword();" value="0" <?php if($process_type == "EDIT"){echo "checked='true'";} ?> /> No
	</div>
	<div style="clear:both;"></div>
</div>
<?php } ?>
<?php if(($_SESSION['usergroupid'] != 1 || $_SESSION['usergroupid'] != 2) || ($process_type == "ADD" || $process_type == "EDIT")){ ?>
<div style="height:50px;">
	<div class="divPassword">
		<div class="divFormRowData">
			<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;"><span class="divPassword">New Password</span></div>
			<div style="float:left;">&nbsp;:&nbsp;</div>
			<div style="float:left;">
				<input type="password" name="txt_user_password_new" value="" style="width:200px; height:18px;" />
			</div>
			<div style="clear:both;"></div>
		</div>
		<div class="divFormRowData">

			<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Confirm New Password</div>
			<div style="float:left;">&nbsp;:&nbsp;</div>
			<div style="float:left;">
				<input type="password" name="txt_user_password_new_c" value="" style="width:200px; height:18px;" />
			</div>
			<div style="clear:both;"></div>
		</div>
	</div>
</div>
<?php } ?>
<?php } ?>
<!-- End Row Data -->
<script type="text/javascript">
	//document.getElementById("divPassword").style.visibility = "hidden";
<?php if($process_type == "EDIT"){ ?>
	$(".divPassword").hide();
<?php } ?>
	function showhidePassword()
	{
		var yes = document.getElementById("rdoPasswordYes");
		var no = document.getElementById("rdoPasswordNo");
		
		if(yes.checked == true || no.checked == false)
		{
			$(".divPassword").fadeIn(1000);
		}
		else if(yes.checked == false || no.checked == true)
		{
			$(".divPassword").fadeOut(1000);
		}
	}
</script>